<?php

use Illuminate\Support\Facades\Route;
use Modules\Category\Http\Controllers\CategoryController;
use Modules\Category\Http\Controllers\MenuController;

// 定义select路由
Route::get('api/category/select', [CategoryController::class, 'select']);

// // 定义category路由
Route::prefix('api')->group(function () {
    // 明确定义各个路由，避免使用resource路由可能导致的冲突
    Route::get('category/{category}', [CategoryController::class, 'show'])->name('category.show');
    Route::get('category', [CategoryController::class, 'index'])->name('category.index');
    Route::post('category', [CategoryController::class, 'store'])->name('category.store');
    Route::put('category/{id}', [CategoryController::class, 'update'])->name('category.update');
    Route::delete('category/{id}', [CategoryController::class, 'destroy'])->name('category.destroy');
});
// routes.php
Route::prefix('api')->group(function () {
    Route::resource('menus', MenuController::class);
});
